package iexception;

class Login{
    private String userName;
    private String passWord;

    public Login(String userName, String passWord) {
        this.userName = userName;
        this.passWord = passWord;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public void logINfo(String userName, String passWord) throws UserNameException,PassWordException{
        if(!this.userName.equals(userName)){
            throw new UserNameException("用户名异常...");
        }
        if(!this.passWord.equals(passWord)){
            throw new PassWordException("密码异常...");
        }
    }
}
public class Test {
    public static void main(String[] args) {
        Login login = new Login("abc","123456");
        try{
            login.logINfo("abc","12345");
        }catch(UserNameException e){
            e.printStackTrace();
        }catch (PassWordException e){
            e.printStackTrace();
        }finally{
            System.out.println("结束...");
        }
    }
}
